﻿package mortal.game.view.mount
{
    import Message.Game.*;
    import __AS3__.vec.*;
    import flash.utils.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.mount.data.*;

    public class MountCache extends Object
    {
        public var mountData:MountData;
        public var isHideFasionEquip:int;
        private var _mountCards:Vector.<MountCardData>;
        private var _manureCards:Vector.<ManureCardData>;
        public var currentAmount:int;
        public var lastTime:Date;
        private var _equipConfigInfoDic:Dictionary;

        public function MountCache()
        {
            this._manureCards = new Vector.<ManureCardData>;
            this._equipConfigInfoDic = new Dictionary();
            return;
        }// end function

        public function updateMountCards(param1:Array) : void
        {
            var _loc_4:int = 0;
            var _loc_2:* = this.mountCards.length;
            var _loc_3:int = 0;
            while (_loc_3 < _loc_2)
            {
                
                _loc_4 = 0;
                while (_loc_4 < param1.length)
                {
                    
                    if ((param1[_loc_4] as SMountCard).code == (_loc_3 + 1))
                    {
                        this.mountCards[_loc_3].sMountCard = param1[_loc_4] as SMountCard;
                        break;
                    }
                    _loc_4++;
                }
                _loc_3++;
            }
            return;
        }// end function

        public function updateMountCard(param1:SMountCard) : void
        {
            var _loc_2:* = param1.code - 1;
            this.mountCards[_loc_2].sMountCard = param1;
            return;
        }// end function

        public function get mountCards() : Vector.<MountCardData>
        {
            var _loc_1:MountCardData = null;
            var _loc_2:int = 0;
            if (this._mountCards == null)
            {
                this._mountCards = new Vector.<MountCardData>;
                _loc_2 = 0;
                while (_loc_2 < 10)
                {
                    
                    _loc_1 = new MountCardData((_loc_2 + 1) + "_" + 0);
                    this._mountCards.push(_loc_1);
                    _loc_2++;
                }
            }
            return this._mountCards;
        }// end function

        public function updateManureCards(param1:Array) : void
        {
            var _loc_2:SManureCard = null;
            this._manureCards.length = 0;
            for each (_loc_2 in param1)
            {
                
                this._manureCards.push(new ManureCardData(_loc_2));
            }
            return;
        }// end function

        public function get manureCards() : Vector.<ManureCardData>
        {
            return this._manureCards;
        }// end function

        public function updateManureCard(param1:SManureCard) : void
        {
            this._manureCards.push(new ManureCardData(param1));
            return;
        }// end function

        public function get isManuringCard() : Boolean
        {
            return this._manureCards.length == 18 ? (false) : (true);
        }// end function

        public function getOpenCardsNum() : int
        {
            return this._manureCards.length;
        }// end function

        public function clearManureList() : void
        {
            this._manureCards.length = 0;
            return;
        }// end function

        public function get isHasActiveCard() : Boolean
        {
            var _loc_1:MountCardData = null;
            for each (_loc_1 in this._mountCards)
            {
                
                if (_loc_1.isHasCard && _loc_1.isCanActive == false)
                {
                    return true;
                }
            }
            return false;
        }// end function

        public function getMountEquipConfigInfo(param1:ItemData) : ItemEquipInfo
        {
            var _loc_2:ItemEquipInfo = null;
            var _loc_3:* = param1.itemInfo.category + "-" + param1.itemInfo.type + "-" + param1.itemInfo.level;
            _loc_2 = this._equipConfigInfoDic[_loc_3] as ItemEquipInfo;
            if (_loc_2 == null)
            {
                _loc_2 = ItemConfig.instance.getMountEquipByLevel(param1.itemInfo.category, param1.itemInfo.type, param1.itemInfo.level, 0);
                this._equipConfigInfoDic[_loc_3] = _loc_2;
            }
            return _loc_2;
        }// end function

    }
}
